<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
</script>
<style>
		label, input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { margin: 10px 0; }
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .2em 10px; text-align: left; }
		.ui-dialog .ui-state-error { padding: .3em; }
		.validateTips { border: 1px solid transparent; padding: 0.3em; }
</style>
<div class="publications view">
	<h2><?php  __('Publication');?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['title']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Subtitle'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['subtitle']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Edition'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['edition']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Isbn'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['isbn']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Year'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['year']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comments'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['comments']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['created']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $publication['Publication']['modified']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Publisher'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($publication['Publisher']['name'], array('controller' => 'publishers', 'action' => 'view', $publication['Publisher']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Type'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($publication['Type']['name'], array('controller' => 'types', 'action' => 'view', $publication['Type']['id'])); ?>
			&nbsp;
		</dd>
	</dl>
	
	<div id="tabs">
		<ul>
			<li><a href="#tab-copies"><?php __('Related Copies');?></a></li>
			<li><a href="#tab-authors"><?php __('Related Authors');?></a></li>
			<li><a href="#tab-menthors"><?php __('Related Menthors');?></a></li>
			<li><a href="#tab-categories"><?php __('Related Categories');?></a></li>
		</ul>
		<div id="tab-copies">
<?php if (!empty($publication['Copy'])):?>
			<table cellpadding = "0" cellspacing = "0" class="ui-widget ui-widget-content">
			<tr>
				<th><?php __('Id'); ?></th>
				<th><?php __('Loaned'); ?></th>
				<th><?php __('Created'); ?></th>
				<th><?php __('Publication Id'); ?></th>
				<th class="actions"><?php __('Actions');?></th>
			</tr>
<?php
	$i = 0;
	foreach ($publication['Copy'] as $copy):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
?>
			<tr<?php echo $class;?>>
				<td><?php echo $copy['id'];?></td>
				<td><?php echo $copy['loaned'];?></td>
				<td><?php echo $copy['created'];?></td>
				<td><?php echo $copy['publication_id'];?></td>
				<td class="actions">
					<?php echo $this->Html->link(__('View', true), array('controller' => 'copies', 'action' => 'view', $copy['id'])); ?>
					<?php echo $this->Html->link(__('Edit', true), array('controller' => 'copies', 'action' => 'edit', $copy['id'])); ?>
					<?php echo $this->Html->link(__('Delete', true), array('controller' => 'copies', 'action' => 'delete', $copy['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $copy['id'])); ?>
				</td>
			</tr>
<?php endforeach; ?>
			</table>
<?php endif; ?>
			<div class="actions">
				<ul>
					<li><?php echo $this->Html->link(__('New Copy', true), array('controller' => 'copies', 'action' => 'add'));?> </li>
				</ul>
			</div>
		</div>
		<div id="tab-authors">
			<?php if (!empty($publication['Author'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Name'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Modified'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($publication['Author'] as $author):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $author['id'];?></td>
			<td><?php echo $author['name'];?></td>
			<td><?php echo $author['created'];?></td>
			<td><?php echo $author['modified'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'authors', 'action' => 'view', $author['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'authors', 'action' => 'edit', $author['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'authors', 'action' => 'delete', $author['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $author['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Author', true), array('controller' => 'authors', 'action' => 'add'));?> </li>
		</ul>
	</div>
		</div>
		<div id="tab-menthors">
<?php if (!empty($publication['Menthor'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Name'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Modified'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($publication['Menthor'] as $menthor):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $menthor['id'];?></td>
			<td><?php echo $menthor['name'];?></td>
			<td><?php echo $menthor['created'];?></td>
			<td><?php echo $menthor['modified'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'menthors', 'action' => 'view', $menthor['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'menthors', 'action' => 'edit', $menthor['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'menthors', 'action' => 'delete', $menthor['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $menthor['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Menthor', true), array('controller' => 'menthors', 'action' => 'add'));?> </li>
		</ul>
	</div>
		</div>
		<div id="tab-categories">
		<?php if (!empty($publication['Category'])):?>
			<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Name'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Modified'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($publication['Category'] as $category):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $category['id'];?></td>
			<td><?php echo $category['name'];?></td>
			<td><?php echo $category['created'];?></td>
			<td><?php echo $category['modified'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'categories', 'action' => 'view', $category['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'categories', 'action' => 'edit', $category['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'categories', 'action' => 'delete', $category['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $category['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Category', true), array('controller' => 'categories', 'action' => 'add'));?> </li>
		</ul>
	</div>
		</div>
	</div>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit Publication', true), array('action' => 'edit', $publication['Publication']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Delete Publication', true), array('action' => 'delete', $publication['Publication']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $publication['Publication']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('List Publications', true), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Publication', true), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Publishers', true), array('controller' => 'publishers', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Publisher', true), array('controller' => 'publishers', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Types', true), array('controller' => 'types', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Type', true), array('controller' => 'types', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Copies', true), array('controller' => 'copies', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Copy', true), array('controller' => 'copies', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Authors', true), array('controller' => 'authors', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Author', true), array('controller' => 'authors', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Categories', true), array('controller' => 'categories', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Category', true), array('controller' => 'categories', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Menthors', true), array('controller' => 'menthors', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Menthor', true), array('controller' => 'menthors', 'action' => 'add')); ?> </li>
	</ul>
</div>
